#include <iostream>
using namespace std;

const int DAYS_IN_YEAR = 365; 
const int I_YEAR       = 1970; 



bool leapyear(int y)
{
    if ((y%4==0&&y%100!=0)||y%400==0)
		return true;
	return false;
}


int count_of_leaps(int year, int b_year = I_YEAR)
{
	return 97*(year+b_year)/400 - 97*b_year/400;
}


long first_day_in_year(int year)
{
	long fd = DAYS_IN_YEAR*year + 
		count_of_leaps(year);
	return fd;
}


int	year(long d_num)  
{
	int y = d_num/DAYS_IN_YEAR - 
		count_of_leaps(d_num/DAYS_IN_YEAR)/(DAYS_IN_YEAR+1);
	return y+I_YEAR;
}


int main()
{
	int cy = 0;
	for (long i = 0; i < 200000; i+=DAYS_IN_YEAR)
	{
		if (leapyear(cy + I_YEAR))
			++i;
		cout << i << '\t' << cy+I_YEAR	<< '\t' 
			<< year(i) << '\t' << first_day_in_year(cy) << endl;
		++cy;
	}

	
	system("pause");
	return 0;
}